{include file="common/head" /}
  <body>
    <div class="x-body">
        <form class="layui-form">
            <input type="hidden" name="id" value="{$order.id}">
            <div class="layui-form-item">
                <label class="layui-form-label">
                   订单编号
                </label>
                <div class="layui-input-inline">
                    <input type="text"   class="layui-input" value="{$order.order_no}" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    订单总价
                </label>
                <div class="layui-input-inline">
                    <input type="text"   class="layui-input" value="{$order.total_price}" disabled>
                </div>
            </div>
          <div class="layui-form-item">
              <label  class="layui-form-label">
                  收货人
              </label>
              <div class="layui-input-inline">
                  <input type="text"   class="layui-input" value="{$order.member_address.name}" disabled>
              </div>
          </div>
          <div class="layui-form-item">
              <label  class="layui-form-label">
                  电话号码
              </label>
              <div class="layui-input-inline">
                  <input type="text"   value="{$order.member_address.mobile}" class="layui-input" disabled>
              </div>
          </div>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    收货地址
                </label>
                <div class="layui-input-inline">
                    <input type="text"   value="{$order.member_address.province} {$order.member_address.city} {$order.member_address.country} {$order.member_address.detail}" class="layui-input" disabled>
                </div>
            </div>
            <div class="layui-form-item">
                <label  class="layui-form-label">
                    订单创建时间
                </label>
                <div class="layui-input-inline">
                    <input type="text"  value="{$order.create_time}" class="layui-input" disabled>
                </div>
            </div>
            <table class="layui-table">
                <thead>
                <tr>
                    <!--<th>-->
                    <!--<div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>-->
                    <!--</th>-->
                    <th>商品主图</th>
                    <th>商品名称</th>
                    <th>单价(元)</th>
                    <th>购买数(束)</th>
                    <th>总价</th>
                </thead>
                <tbody>
                {volist name='order_goods' id='good'}
                <tr>
                    <!--<td>-->
                    <!--<div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>-->
                    <!--</td>-->
                    <td><img src="/images/{$good.good.main_img_url}" alt=""></td>
                    <td>{$good.good.name}</td>
                    <td>{$good.good.price}</td>
                    <td>{$good.count}</td>
                    <td>{$good.count * $good.good.price}</td>
                </tr>
                {/volist}
                </tbody>
            </table>
            {$order_goods->render()}

            {if condition="$order.status == '已确认'"}
          <div class="layui-form-item">
              <label class="layui-form-label"></label>
              <button  class="layui-btn" lay-filter="send_out" lay-submit="">
                  点击发货
              </button>
          </div>
            {/if}
      </form>
    </div>
    <script>
        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer;
          //监听提交
          form.on('submit(send_out)', function(data){

              $.post('/admin/send_out',{id:data.field.id,status:3},function (ret) {
                  if(ret.code == 1){
                      layer.alert(ret.msg, {icon: 6},function () {
                          // 获得frame索引
                          var index = parent.layer.getFrameIndex(window.name);
                          //关闭当前frame
                          parent.layer.close(index);
                      });
                  }else{
                      layer.alert(ret.msg, {icon: 5});
                  }

              });
            return false;
          });
        });
    </script>
  </body>

</html>